package com.czp.infosharingplatformapp.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoContributor;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.client.WebClient;

import java.util.HashMap;
import java.util.Map;

@Component
public class CustomInfoContributor implements InfoContributor {

    @Value("${app.name}")
    private String applicationName;

    @Value("${app.version}")
    private String applicationVersion;

    @Value("${app.description}")
    private String applicationDescription;

    @Value("${app.owner}")
    private String applicationOwner;

    @Override
    public void contribute(Info.Builder builder) {
        Map<String, Object> customInfo = new HashMap<>();
        customInfo.put("app.name", applicationName);
        customInfo.put("app.description", applicationDescription);
        customInfo.put("app.version", applicationVersion);
        customInfo.put("app.owner", applicationOwner);

        builder.withDetail("customInfo", customInfo);
    }
}